Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Android 2022.2.X+ Build Issues #205

Merged
merged 6 commits into from
Apr 9, 2023
Merged

Fix Android 2022.2.X+ Build Issues #205

merged 6 commits into from
Apr 9, 2023

Conversation

AndrewKahr
Copy link
Member

@AndrewKahr AndrewKahr commented Apr 5, 2023

Changes

  • Allow installation of beta Unity Hub versions
  • Update Unity Hub to the latest beta which fixes 2022.2.X Android build issues.
  • Update the build docker file with new paths for the new Android cli tools
  • Included fix for broken symlinks on new Android tools
  • Remove the Unity Hub version build argument for Windows as older Hub versions are not maintained by Unity preventing them from being downloaded. Passing an old version is likely to break the build as the install script uses hard-coded hashes that may not match the latest version
  • Updated grep error text due to internal errors being thrown to the console that are unrelated to installation tasks in Unity Hub

Checklist

  • Read the contribution guide and accept the code of conduct
  • Readme (updated or not needed)

Additional Context

Unity has updated the naming of its internal packages for Android. Google has also deprecated the bin/sdkmanager in favor of clitools bin/sdkmanager. Below are the path changes throughout the Unity Versions:

Android NDK

Version ID Destination Rename From Rename To
2019.1.0f1 android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.1.14f1 android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.2.0f1 android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.2.21f1 android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.3.0f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.3.15f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.4.0f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2019.4.40f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.1.0f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.1.17f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.2.0f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.2.7f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.3.0f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2020.3.46f1 android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r19 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.1.0f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.1.28f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.2.0f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.2.19f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.3.0f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2021.3.22f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2022.1.0f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2022.1.24f1 android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r21d {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2022.2.0f1 android-ndk-r23b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r23b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK
2022.2.13f1 android-ndk-r23b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r23b {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/NDK

Android OpenJDK

Version ID Destination Rename From Rename To
2019.1.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.1.14f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.2.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.2.21f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.3.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.3.15f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.4.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2019.4.40f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.1.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.1.17f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.2.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.2.7f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.3.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2020.3.46f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.1.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.1.28f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.2.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.2.19f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.3.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2021.3.22f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2022.1.0f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2022.1.24f1 android-open-jdk-8u172-b11 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2022.2.0f1 android-open-jdk-11.0.14.1+1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A
2022.2.13f1 android-open-jdk-11.0.14.1+1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK N/A N/A

Android SDK Platform Tools

Version ID Destination Rename From Rename To
2019.1.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.1.14f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.2.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.2.21f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.3.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.3.15f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.4.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2019.4.40f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.1.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.1.17f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.2.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.2.7f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.3.0f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2020.3.46f1 android-sdk-platform-tools-28.0.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.1.0f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.1.28f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.2.0f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.2.19f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.3.0f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2021.3.22f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2022.1.0f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2022.1.24f1 android-sdk-platform-tools-30.0.4 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2022.2.0f1 android-sdk-platform-tools-32.0.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A
2022.2.13f1 android-sdk-platform-tools-32.0.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK N/A N/A

Android SDK Command Line Tools

Version ID Destination Rename From Rename To
2019.1.0f1 N/A N/A N/A N/A
2019.1.14f1 N/A N/A N/A N/A
2019.2.0f1 N/A N/A N/A N/A
2019.2.21f1 N/A N/A N/A N/A
2019.3.0f1 N/A N/A N/A N/A
2019.3.15f1 N/A N/A N/A N/A
2019.4.0f1 N/A N/A N/A N/A
2019.4.40f1 N/A N/A N/A N/A
2020.1.0f1 N/A N/A N/A N/A
2020.1.17f1 N/A N/A N/A N/A
2020.2.0f1 N/A N/A N/A N/A
2020.2.7f1 N/A N/A N/A N/A
2020.3.0f1 N/A N/A N/A N/A
2020.3.46f1 N/A N/A N/A N/A
2021.1.0f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2021.1.28f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2021.2.0f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2021.2.19f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2021.3.0f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2021.3.22f1 android-sdk-command-line-tools-2.1 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/2.1
2022.1.0f1 android-sdk-command-line-tools-6.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/6.0
2022.1.24f1 android-sdk-command-line-tools-6.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/6.0
2022.2.0f1 android-sdk-command-line-tools-6.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/6.0
2022.2.13f1 android-sdk-command-line-tools-6.0 {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/cmdline-tools {UNITY_PATH}/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/cmdline-tools/6.0

Scripts to Generate the Tables

Build Images (buildall.sh)

#!/bin/bash

set -e

UNITY_VERSION=("2019.1.0f1" "2019.1.14f1" "2019.2.0f1" "2019.2.21f1" "2019.3.0f1" "2019.3.15f1" "2019.4.0f1" "2019.4.40f1" "2020.1.0f1" "2020.1.17f1" "2020.2.0f1" "2020.2.7f1" "2020.3.0f1" "2020.3.46f1" "2021.1.0f1" "2021.1.28f1" "2021.2.0f1" "2021.2.19f1" "2021.3.0f1" "2021.3.22f1" "2022.1.0f1" "2022.1.24f1" "2022.2.0f1" "2022.2.13f1")
HUB_VERSION="3.4.2-beta.1"

docker build ./images/ubuntu/base -t "unityci/base"

docker build ./images/ubuntu/hub -t "unityci/hub" --build-arg hubVersion=$HUB_VERSION

# Loop through the Unity versions and get the changeset for each one
for version in "${UNITY_VERSION[@]}"; do
  UNITY_CHANGESET+=("$(npx unity-changeset $version)")
done

function build_image() {
    version=$1
    changeSet=$2
    docker build --progress=plain ./images/ubuntu/editor -t "unityci/editor:ubuntu-$version-android" \
      --build-arg version=$version \
      --build-arg changeSet=$changeSet \
      --build-arg module=android
}

# Loop through the arrays in parallel
for i in "${!UNITY_VERSION[@]}"; do
  version=${UNITY_VERSION[i]}
  changeSet=${UNITY_CHANGESET[i]}
  build_image $version $changeSet &
done

# Wait for all processes to finish
wait

Pull Modules.json from each image (pullall.sh)

UNITY_VERSIONS=("2019.1.0f1" "2019.1.14f1" "2019.2.0f1" "2019.2.21f1" "2019.3.0f1" "2019.3.15f1" "2019.4.0f1" "2019.4.40f1" "2020.1.0f1" "2020.1.17f1" "2020.2.0f1" "2020.2.7f1" "2020.3.0f1" "2020.3.46f1" "2021.1.0f1" "2021.1.28f1" "2021.2.0f1" "2021.2.19f1" "2021.3.0f1" "2021.3.22f1" "2022.1.0f1" "2022.1.24f1" "2022.2.0f1" "2022.2.13f1")

mkdir -p c:/path/to/folder/modules

for UNITY_VERSION in ${UNITY_VERSIONS[@]}; do
    UNITY_VERSION_PATH_SAFE=$(echo $UNITY_VERSION | tr '.' '-')
    docker run --rm \
        -v "c:/path/to/folder/modules:/modules" \
        unityci/editor:ubuntu-${UNITY_VERSION}-android \
        cp /opt/unity/modules.json /modules/modules-${UNITY_VERSION_PATH_SAFE}.json
done

Generate Markdown (GenerateMD.ps1)

# Define module IDs to extract
$module_ids = @("android-sdk-platform-tools", "android-ndk", "android-open-jdk", "android-sdk-command-line-tools")

# Loop over module IDs
foreach ($module_id in $module_ids) {
    # Create output file for this module ID
    $output_file = "modulemd/$module_id.md"
    Write-Host "Generating $output_file"
    
    # Create table header
    $table = "| Version | ID | Destination | Rename From | Rename To |`n| --- | --- | --- | --- | --- |`n"
    
    # Loop over version numbers
    foreach ($version in $version_list) {
        # Replace periods with dashes in version number
        $version_with_dashes = $version -replace "\.", "-"
        
        # Construct path to module file
        $module_file = "modules/modules-$version_with_dashes.json"
        
        # Read module data from file
        $json = Get-Content $module_file
        $json = $json.ToString().Replace("preselected", "_preselected")
        $module_data = $json | ConvertFrom-Json
        
        # Find objects with matching module ID
        $module_objects = $module_data | Where-Object { $_.id -like "$module_id*" }
        
        # If no matching objects, add N/A to table
        if ($module_objects.Count -eq 0) {
            $table += "| $version | N/A | N/A | N/A | N/A |`n"
            continue
        }
        
        # Loop over module objects
        foreach ($module_object in $module_objects) {
            # Get values for table
            $id = $module_object.id
            if ([string]::IsNullOrEmpty($id)) { $id = "N/A" }
            $destination = $module_object.destination
            if ([string]::IsNullOrEmpty($destination)) { $destination = "N/A" }
            $rename_from = $module_object.renameFrom
            if ([string]::IsNullOrEmpty($rename_from)) { $rename_from = "N/A" }
            $rename_to = $module_object.renameTo
            if ([string]::IsNullOrEmpty($rename_to)) { $rename_to = "N/A" }
            
            # Add row to table
            $table += "| $version | $id | $destination | $rename_from | $rename_to |`n"
        }
    }
    
    # Write table to output file
    $table | Out-File $output_file -Encoding utf8
}

…sues. Remove Unity Hub version for Windows as there is no ability to pin hub versions due to Unity not maintaining old versions. Passing an old version is likely to break the build as the install script uses hard coded hashes that may not match the latest version
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Cat Gif

@AndrewKahr AndrewKahr marked this pull request as draft April 5, 2023 09:48
@AndrewKahr AndrewKahr marked this pull request as ready for review April 6, 2023 23:40
&& . ~/.bashrc \
&& cd "${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin" \
# Symlink any file less than 64 bytes to the file name within the file. We assume there are no real files that small
&& for f in $(find . -type f -size -64c); do target=$(cat $f) && echo "Making symlink $f -> $target" && rm $f && ln -s $target $f ; done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using file size here for the loop? Is it to identify files that are symlinks?
If so, we can do so by using the -L test to determine whether it is a symbolic link.

Example:

RUN echo "$version-$module" | grep -q -vP '^(2022.[2-9]|202[3-9]|20[3-9]).*android' \
  && exit 0 \
  || : \
  && . ~/.bashrc \
  && cd "${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin" \
  && for f in *; do \
       if [ -L "$f" ]; then \
         target=$(readlink "$f") && echo "Making symlink $f -> $target" && rm "$f" && ln -s "$target" "$f"; \
       fi \
     done

I haven't tried this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the files aren't actually symbolic links, they're a mix of ascii and binary files but inside they have the file name of the executable they should point to. We suspect hub isn't using the proper flags when unzipping so the symbolic links get lost hence the need for us to make the links ourselves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly more manageable to separate that part into a different PR? Not sure though. And not preference from my side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the main point of the PR to fix the android build issues of 2022.2+ so I'm inclined to keep this as a single PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, makes sense!

Copy link
Member

@GabLeRoux GabLeRoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fully aware of the context or issues here so it'd be nice to have someone else review this as well, but this seems like a good change overall 👍 Thanks Andrew! :D

@@ -265,6 +265,7 @@ jobs:
# Test #
############
- name: Test project
timeout-minutes: 10
Copy link
Member

@GabLeRoux GabLeRoux Apr 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other reviewers:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes

Default is 360, reducing it to 10 will most likely make it fail faster if necessary 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only a valid setting if you know the maximum amount a project would take to build. Useful for this repo. Perhaps also worth documenting in our docs for GHA?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general you don't really need this setting. I think what is happening is these big matrices of Unity test runs exceed some kind of rate limit for activation endpoint silently which causes it to hang. I just set it to 10 minutes because I saw every test run with our empty test project takes about 1 min so by 10 min it's probably hung and guaranteed to fail. This time is heavily driven by the actual tests and whether the library folder already exists. The activation errors are also generally rare in standard CI runs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are in fact a few cases where implementers of GameCI using GHA are waiting for their run and they report it times out after 5 hours not knowing the error.

Probably the fastest way to setup GameCI (in case anything goes wrong) is to set it up using a test project, and having that setting set to 5 minutes :) Just a suggestion though.

Copy link
Member

@webbertakken webbertakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well, though it's mostly important to verify that the changes do what you expect them to do.

&& . ~/.bashrc \
&& cd "${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin" \
# Symlink any file less than 64 bytes to the file name within the file. We assume there are no real files that small
&& for f in $(find . -type f -size -64c); do target=$(cat $f) && echo "Making symlink $f -> $target" && rm $f && ln -s $target $f ; done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly more manageable to separate that part into a different PR? Not sure though. And not preference from my side.


# Install unity hub
RUN choco install unity-hub --version=%hubVersion --no-progress -y
RUN choco install unity-hub --no-progress -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the version flag? Is the argument no longer valid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually wasn't relevant from the start. Reading more into the readme for the chocolatey package, Unity doesn't store an archive of the older Unity hubs so it will always pull the latest version. The chocolatey script used a hard coded hash for each version to verify the download so putting an older version can cause errors during installs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They must have changed that. I wouldn't have added this param without it being documented.
Nice catch!

@AndrewKahr AndrewKahr merged commit 6d9b762 into main Apr 9, 2023
@AndrewKahr AndrewKahr deleted the fix-android-2022-2 branch April 9, 2023 18:31
mob-sakai pushed a commit to mob-sakai/docker that referenced this pull request Apr 10, 2023
# Conflicts:
#	images/windows/hub/Dockerfile
mob-sakai pushed a commit to mob-sakai/docker that referenced this pull request Dec 27, 2023
# Conflicts:
#	images/windows/hub/Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants